From 35105ab2b44c50a96698cc55a77a68c2e816f56b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tadej=20Borov=C5=A1ak?= Date: Sat, 7 Aug 2010 01:58:29 +0200 Subject: [PATCH] Fix improperly unwinded loops --- gtk/gtkbox.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index be089009d2..cdc5f1d46f 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -542,12 +542,19 @@ gtk_box_size_allocate (GtkWidget *widget, { child = children->data; - /* If widget is not visible or it's packing is not right for current - * loop, skip it. - */ - if (child->pack != packing || !gtk_widget_get_visible (child->widget)) + /* If widget is not visible, skip it. */ + if (!gtk_widget_get_visible (child->widget)) continue; + /* If widget is packed differently skip it, but still increment i, + * since widget is visible and will be handled in next loop iteration. + */ + if (child->pack != packing) + { + i++; + continue; + } + /* Assign the child's size. */ if (private->homogeneous) { @@ -1020,9 +1027,19 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box, { child = children->data; - if (child->pack != packing || !gtk_widget_get_visible (child->widget)) + /* If widget is not visible, skip it. */ + if (!gtk_widget_get_visible (child->widget)) continue; + /* If widget is packed differently skip it, but still increment i, + * since widget is visible and will be handled in next loop iteration. + */ + if (child->pack != packing) + { + i++; + continue; + } + if (child->pack == packing) { /* Assign the child's size. */ -- 2.30.2